dotConnect for Oracle Documentation
Devart.Data.Oracle Namespace / OracleLob Class / Read Method / Read(Char[],Int32,Int32) Method
The character array buffer to be populated.
The zero-based offset in the buffer.
The amount of bytes to read.
Example

Read(Char[],Int32,Int32) Method
Reads a sequence of characters from the current OracleLob stream and advances the position within the stream by the number of bytes read.
Syntax
'Declaration
 
Public Overloads Function Read( _
   ByVal buffer() As Char, _
   ByVal offset As Integer, _
   ByVal count As Integer _
) As Integer
 

Parameters

buffer
The character array buffer to be populated.
offset
The zero-based offset in the buffer.
count
The amount of bytes to read.

Return Value

The total number of characters read into the buffer.
Remarks
The Read method reads a maximum of count bytes from the current stream and stores them in buffer beginning at offset position. The current position within the stream is advanced by the number of bytes read. The Read method returns 0 if the position is at the end of the stream.
Example
In the example below a OracleLob is created with 10 bytes in it. Then Position is changed using Seek method. An attempt to read 10 bytes is made afterwards, however, only 5 bytes remain till the end of the stream, so TargetArray is populated with 5 bytes only.
public void ReadFromMyLob()
{
  byte[] myByteArray = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  byte[] TargetArray = new Byte[15];
  OracleLob myLob = new OracleLob(myByteArray);
  myLob.Seek(5, SeekOrigin.Begin);
  Console.WriteLine(myLob.Read(TargetArray, 0, 10) + " bytes are read");
}
Public Sub ReadFromMyLob()
  Dim myByteArray() As Byte = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
  Dim TargetArray(15) As Byte
  Dim myLob As OracleLob = New OracleLob(myByteArray)
  myLob.Seek(5, SeekOrigin.Begin)
  Console.WriteLine(String.Concat(myLob.Read(TargetArray, 0, 10), " bytes are read"))
End Sub
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also